import axios from '@/libs/axios1'
let jsonHeaders = { 'content-type': 'application/json;charset=UTF-8' }
let base = '/testplatform/extraTest'

// 查询测试活动
export const queryExtraTestList = params => {
  return axios({
    url: `${base}`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}

// 查询测试活动关联的漏洞
export const queryExtraTestVulList = params => {
  let id = params.id;
  delete params.id;
  return axios({
    url: `${base}/${id}/vulPage`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}

// 查询测试活动业务系统
export const queryBusinessSystemList = params => {
  return axios({
    url: `${base}/businessSystemPage`,
    method: 'GET',
    params,
    headers: jsonHeaders,
  })
}

// 创建测试活动
export const addExtraTest = data => {
  return axios({
    url: `${base}`,
    method: 'POST',
    data,
    headers: jsonHeaders,
  })
}

// 修改测试活动
export const updateExtraTest = data => {
  return axios({
    url: `${base}`,
    method: 'PUT',
    data,
    headers: jsonHeaders,
  })
}

// 删除测试活动
export const deleteExtraTest = id => {
  return axios({
    url: `${base}/${id}`,
    method: 'DELETE',
    headers: jsonHeaders,
  })
}
